package com.lune.job.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lune.job.mapper.ResumeMapper;
import com.lune.job.pojo.ResPageBean;
import com.lune.job.pojo.Resume;
import com.lune.job.service.IResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Caiyilin
 * @since 2022-03-06
 */
@Service
public class ResumeServiceImpl extends ServiceImpl<ResumeMapper, Resume> implements IResumeService {

    @Autowired
    private ResumeMapper resumeMapper;

    /**
     * 分页查询简历信息
     * @param currentPage
     * @param size
     * @param resume
     * @return
     */
    @Override
    public ResPageBean queryPage(Integer currentPage, Integer size, Resume resume) {
        Page<Resume> page = new Page<>(currentPage, size);
        IPage<Resume> postIPage = resumeMapper.queryPage(page,resume);
        ResPageBean resPageBean = new ResPageBean(postIPage.getTotal(), postIPage.getPages(), postIPage.getRecords());
        return resPageBean;
    }

    /**
     * 条件查询简历信息
     * @param resume
     * @return
     */
    @Override
    public List<Resume> queryByCon(Resume resume) {
        return resumeMapper.queryByCon(resume);
    }
}
